package com.hljx.job;

import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.job.builder.JobBuilder;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @BelongsProject: hljx
 * @BelongsPackage: com.hljx.job
 * @Author: lp
 * @CreateTime: 2023-10-23  08:55
 * @Description: TODO
 * @Version: 1.0
 */
@Slf4j
@Configuration
public class JobItem {

    private final JobRepository jobRepository;

    public JobItem(JobRepository jobRepository) {
        this.jobRepository = jobRepository;

    }


    @Bean(name = "hisJob")
    public Job hisJob(@Qualifier("adviceItemStep") Step step,@Qualifier("deleteAdviceItemStep") Step deleteStepItem) {
        return new JobBuilder("hisJob", jobRepository)
                .start( deleteStepItem)
                .next(step)
                .build();
    }

    @Bean(name = "ifFeeitemListJob")
    public Job ifFeeitemListJob(@Qualifier("deleteIfFeeItem")Step deleteStep,
            @Qualifier("ifFeeitemListStep")Step step,
            @Qualifier("ifFeeitemListStep2")Step step2){
        return new JobBuilder("ifFeeitemListJob", jobRepository)
                .start(deleteStep)
                .next(step)
                .next(step2)
                .build();
    }

    @Bean("cpoeProjectDischargeExeJob")
    public Job cpoeProjectDischargeExeJob(@Qualifier("deleteCpoeProjectDischargeExeStep")Step deleteStep,
                                          @Qualifier("cpoeProjectDischargeExeStep1")Step step1,
                                          @Qualifier("cpoeProjectDischargeExeStep2")Step step2){
        return new JobBuilder("cpoeProjectDischargeExeJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
            }
    @Bean("RRegisterJob")
    public Job rRegisterJob(@Qualifier("deleteRRegisterStep")Step deleteStep,
                                  @Qualifier("rRegisterStep1")Step step1,
                                  @Qualifier("rRegisterStep2")Step step2){
        return new JobBuilder("rRegisterJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();

    }

     @Bean("VHljxFeedetailJob")
     public Job vHljxFeedetailJob(@Qualifier("deleteVHljxFeedetailStep")Step deleteStep,
                                  @Qualifier("vHljxFeedetailStep1")Step step1,
                                  @Qualifier("vHljxFeedetailStep2")Step step2){
        return new JobBuilder("vHljxFeedetailJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
                                  }
    @Bean("OpRecordJob")
    public Job opRecordJob(@Qualifier("deleteOpRecordStep")Step deleteStep,
                                  @Qualifier("opRecordStep1")Step step1,
                                  @Qualifier("opRecordStep2")Step step2){
        return new JobBuilder("opRecordJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }
    @Bean("ipMomDodJob")
    public Job ipMomDodJob(@Qualifier("deleteIpMomDodStep")Step deleteStep,
                           @Qualifier("ipMomDodStep1")Step step1,
                           @Qualifier("ipMomDodStep2")Step step2){
        return new JobBuilder("ipMomDodJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }

    @Bean("ipMonMexJob")
    public Job ipMonMexJob(@Qualifier("deleteIpMonMexStep")Step deleteStep,
                           @Qualifier("ipMonMexStep1")Step step1,
                           @Qualifier("ipMonMexStep2")Step step2){
        return new JobBuilder("ipMonMexJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }

    @Bean("undrugDetailJob")
    public Job undrugDetailJob(@Qualifier("deleteUndrugDetailStep")Step deleteStep,
                           @Qualifier("undrugDetailStep1")Step step1,
                           @Qualifier("undrugDetailStep2")Step step2){
        return new JobBuilder("undrugDetailJob",jobRepository)
                .start(deleteStep)
                .next(step1)
              .next(step2)
                .build();
    }
    @Bean("clinicInvoiceJob")
    public Job clinicInvoiceJob(@Qualifier("deleteClinicInvoiceStep")Step deleteStep,
                               @Qualifier("clinicInvoiceStep1")Step step1,
                               @Qualifier("clinicInvoiceStep2")Step step2){
        return new JobBuilder("clinicInvoiceJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }

    @Bean("iiBedUseRecordJob")
    public Job iiBedUseRecordJob(@Qualifier("deleteIiBedUseRecordStep")Step deleteStep,
                                @Qualifier("iiBedUseRecordStep1")Step step1,
                                @Qualifier("iiBedUseRecordStep2")Step step2){
        return new JobBuilder("iiBedUseRecordJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }

    @Bean("iiShiftDataJob")
    public Job iiShiftDataJob(@Qualifier("deleteIiShiftDataStep")Step deleteStep,
                                 @Qualifier("iiShiftDataStep1")Step step1,
                                 @Qualifier("iiShiftDataStep2")Step step2){
        return new JobBuilder("iiShiftDataJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }

    @Bean("incomeExpensesJob")
    public Job incomeExpensesJob(@Qualifier("deleteIncomeExpensesStep")Step deleteStep,
                              @Qualifier("incomeExpensesStep1")Step step1,
                              @Qualifier("incomeExpensesStep2")Step step2){
        return new JobBuilder("incomeExpensesJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }

    @Bean("llOneBackExpensesJob")
    public Job llOneBackExpensesJob(@Qualifier("deleteLlOneBackExpensesStep")Step deleteStep,
                                 @Qualifier("llOneBackExpensesStep1")Step step1,
                                 @Qualifier("llOneBackExpensesStep2")Step step2){
        return new JobBuilder("llOneBackExpensesJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }

    @Bean("mrmsbaseJob")
    public Job mrmsbaseJob(@Qualifier("deleteMrmsbaseStep")Step deleteStep,
                                    @Qualifier("mrmsbaseStep1")Step step1,
                                    @Qualifier("mrmsbaseStep2")Step step2){
        return new JobBuilder("mrmsbaseJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }

    @Bean("mrmsdymrJob")
    public Job mrmsdymrJob(@Qualifier("deleteMrmsdymrStep")Step deleteStep,
                           @Qualifier("mrmsdymrStep1")Step step1,
                           @Qualifier("mrmsdymrStep2")Step step2){
        return new JobBuilder("mrmsdymrJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }

    @Bean("opApplyJob")
    public Job opApplyJob(@Qualifier("deleteOpApplyStep")Step deleteStep,
                           @Qualifier("opApplyStep1")Step step1,
                           @Qualifier("opApplyStep2")Step step2){
        return new JobBuilder("opApplyJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }

    @Bean("ordSeedoctrecordJob")
    public Job ordSeedoctrecordJob(@Qualifier("deleteOrdSeedoctrecordStep")Step deleteStep,
                          @Qualifier("ordSeedoctrecordStep1")Step step1,
                          @Qualifier("ordSeedoctrecordStep2")Step step2){
        return new JobBuilder("ordSeedoctrecordJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }

    @Bean("rMzClassCollectYardJob")
    public Job rMzClassCollectYardJob(@Qualifier("deleteRMzClassCollectYardStep")Step deleteStep,
                                   @Qualifier("rMzClassCollectYardStep1")Step step1,
                                   @Qualifier("rMzClassCollectYardStep2")Step step2){
        return new JobBuilder("rMzClassCollectYardJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }

    @Bean("rStatMzClassCollectJob")
    public Job rStatMzClassCollectJob(@Qualifier("deleteRStatMzClassCollectStep")Step deleteStep,
                                      @Qualifier("rStatMzClassCollectStep1")Step step1,
                                      @Qualifier("rStatMzClassCollectStep2")Step step2){
        return new JobBuilder("rStatMzClassCollectJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }

    @Bean("rStatMzCollectJob")
    public Job rStatMzCollectJob(@Qualifier("deleteRStatMzCollectStep")Step deleteStep,
                                      @Qualifier("rStatMzCollectStep1")Step step1,
                                      @Qualifier("rStatMzCollectStep2")Step step2){
        return new JobBuilder("rStatMzCollectJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }
    @Bean("VmHdTreatJob")
    public Job VmHdTreatJob(@Qualifier("deleteVmHdTreatStep")Step deleteStep,
                                 @Qualifier("VmHdTreatStep1")Step step1,
                                 @Qualifier("VmHdTreatStep2")Step step2){
        return new JobBuilder("VmHdTreatJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }

    @Bean("VmHdTreatXGJob")
    public Job VmHdTreatXGJob(@Qualifier("deleteVmHdTreatXGStep")Step deleteStep,
                             @Qualifier("VmHdTreatXGStep1")Step step1,
                             @Qualifier("VmHdTreatXGStep2")Step step2){
        return new JobBuilder("VmHdTreatXGJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }

    @Bean("MedOperationMasterJob")
    public Job MedOperationMasterJob(@Qualifier("deleteMedOperationMasterStep")Step deleteStep,
                            @Qualifier("MedOperationMasterStep1")Step step1,
                            @Qualifier("MedOperationMasterStep2")Step step2){
        return new JobBuilder("MedOperationMasterJob",jobRepository)
                .start(deleteStep)
                .next(step1)
                .next(step2)
                .build();
    }

    @Bean("iaFeelistJob")
    public Job iaFeelistJob(@Qualifier("initIaFeelist")Step init,
                                 @Qualifier("saveIaFeelist")Step save){
        return new JobBuilder("iaFeelistJob",jobRepository)
                .start(init)
                .next(save)
                .build();
    }

    @Bean("mrmsbasetimeJob")
    public Job mrmsbasetimeJob(@Qualifier("initMrmsbasetime")Step init,
                                 @Qualifier("saveMrmsbasetime")Step save){
        return new JobBuilder("mrmsbasetimeJob",jobRepository)
                .start(init)
                .next(save)
                .build();
    }

    @Bean("privDeptJob")
    public Job privDeptJob(@Qualifier("initPrivDept")Step init,
                                 @Qualifier("savePrivDept")Step save){
        return new JobBuilder("privDeptJob",jobRepository)
                .start(init)
                .next(save)
                .build();
    }

    @Bean("rDepartmentJob")
    public Job rDepartmentJob(@Qualifier("initRDepartment")Step init,
                                 @Qualifier("saveRDepartment")Step save){
        return new JobBuilder("rDepartmentJob",jobRepository)
                .start(init)
                .next(save)
                .build();
    }

    @Bean("rEmployeeJob")
    public Job rEmployeeJob(@Qualifier("initREmployee")Step init,
                                 @Qualifier("saveREmployee")Step save){
        return new JobBuilder("rEmployeeJob",jobRepository)
                .start(init)
                .next(save)
                .build();
    }
    @Bean(name = "vCssdWorkloadJob")
    public Job vCssdWorkloadJob(@Qualifier("deleteVCssdWorkload")Step deleteStep,
                                @Qualifier("vCssdWorkloadStep1")Step step,
                                @Qualifier("vCssdWorkloadStep2")Step step2){
        return new JobBuilder("vCssdWorkloadJob", jobRepository)
                .start(deleteStep)
                .next(step)
                .next(step2)
                .build();
    }
}
